home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gnugo1_1.lha / gnugo / fioe.c < prev    next >
C/C++ Source or Header  |  1989-03-07  |  3KB  |  87 lines

  1. /*
  2.                 GNU GO - the game of Go (Wei-Chi)
  3.                 Version 1.1   last revised 3-1-89
  4.            Copyright (C) Free Software Foundation, Inc.
  5.                       written by Man L. Li
  6.                       modified by Wayne Iba
  7.                     documented by Bob Webber
  8. */
  9. /*
  10. This program is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation - version 1.
  13.  
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. GNU General Public License in file COPYING for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software
  21. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23. Please report any bug/fix, modification, suggestion to
  24.  
  25. mail address:   Man L. Li
  26.                 Dept. of Computer Science
  27.                 University of Houston
  28.                 4800 Calhoun Road
  29.                 Houston, TX 77004
  30.  
  31. e-mail address: manli@cs.uh.edu         (Internet)
  32.                 coscgbn@uhvax1.bitnet   (BITNET)
  33.                 70070,404               (CompuServe)
  34. */
  35.  
  36. #include <stdio.h>
  37.  
  38. extern unsigned char p[19][19];
  39. extern int mymove;
  40.  
  41. fioe(i, j)
  42.  
  43. int i, j;
  44. {
  45. /* check top edge */
  46.  if (i == 0)
  47.    {
  48.     if ((j == 0) && ((p[1][0] == mymove) && (p[0][1] == mymove))) return 1;
  49.     if ((j == 18) && ((p[1][18] == mymove) && (p[0][17] == mymove))) return 1;
  50.     if ((p[1][j] == mymove) &&
  51.     ((p[0][j - 1] == mymove) && (p[0][j + 1] == mymove))) return 1;
  52.     else
  53.        return 0;
  54.   }
  55. /* check bottom edge */
  56.  if (i == 18)
  57.    {
  58.     if ((j == 0) && ((p[17][0] == mymove) && (p[18][1] == mymove))) return 1;
  59.     if ((j == 18) && ((p[17][18] == mymove) && (p[18][17] == mymove))) return 1;
  60.     if ((p[17][j] == mymove) &&
  61.     ((p[18][j - 1] == mymove) && (p[18][j + 1] == mymove)))
  62.        return 1;
  63.     else
  64.        return 0;
  65.   }
  66. /* check left edge */
  67.  if (j == 0)
  68.     if ((p[i][1] == mymove) &&
  69.     ((p[i - 1] [0] == mymove) && (p[i + 1][0] == mymove)))
  70.        return 1;
  71.     else
  72.        return 0;
  73. /* check right edge */
  74.  if (j == 18)
  75.     if ((p[i][17] == mymove) &&
  76.     ((p[i - 1] [18] == mymove) && (p[i + 1][18] == mymove)))
  77.        return 1;
  78.     else
  79.        return 0;
  80. /* check center pieces */
  81.  if (((p[i][j - 1] == mymove) && (p[i][j + 1] == mymove)) &&
  82.      ((p[i - 1][j] == mymove) && (p[i + 1][j] == mymove)))
  83.     return 1;
  84.  else
  85.     return 0;
  86. }  /* fioe */
  87.